Page({
    data: {
        tabArr: {
            curHdIndex: 1,
            curBdIndex: 1
        },
        _datasetId: null,
        billType: null,
        userPwd: "商品明细",
        userName: "个人",
        CompanyName: "",
        CompanyContent: "商品明细",
        CompanyNumber: "",
        checked: !1
    },
    onShareAppMessage: function(t) {},
    onLoad: function(t) {
        var e = wx.getStorageSync("checked") || !1;
        wx.setStorageSync("checked", e);
        var a = wx.getStorageSync("billType") || 1, n = wx.getStorageSync("billTitle") || "", i = wx.getStorageSync("billContent3");
        1 == a ? this.setData({
            _datasetId: 1,
            billType: a,
            CompanyName: "",
            CompanyNumber: "",
            checked: e
        }) : 2 == a && this.setData({
            _datasetId: 2,
            billType: a,
            CompanyName: n,
            CompanyNumber: i,
            checked: e
        });
    },
    onshow: function() {},
    tabFun: function(t) {
        var e = t.target.dataset.id, a = {};
        a.curHdIndex = e, a.curBdIndex = e, this.setData({
            tabArr: a,
            _datasetId: e
        }), this.setData({
            billType: e
        });
    },
    userNameInput: function(t) {
        this.setData({
            userName: t.detail.value
        });
    },
    passWdInput: function(t) {
        this.setData({
            userPwd: t.detail.value
        });
    },
    companyNameInput: function(t) {
        this.setData({
            CompanyName: t.detail.value
        });
    },
    companyContentInput: function(t) {
        this.setData({
            CompanyContent: t.detail.value
        });
    },
    companyNumberInput: function(t) {
        this.setData({
            CompanyNumber: t.detail.value
        });
    },
    loginBtnClick: function(t) {
        var e = this.data.checked;
        if (1 == this.data._datasetId) {
            if (!e) return void wx.navigateBack({
                delta: 1
            });
            if ("" == this.data.userName) return void wx.showToast({
                title: "请输入发票抬头",
                icon: "none",
                duration: 2e3
            });
            if ("" == this.data.userPwd) return void wx.showToast({
                title: "请输入发票内容",
                icon: "none",
                duration: 2e3
            });
            wx.setStorageSync("billTitle", this.data.userName), wx.setStorageSync("billContent", this.data.userPwd), 
            wx.setStorageSync("billType", this.data.billType), wx.setStorageSync("billContent3", ""), 
            wx.navigateBack({
                delta: 1
            });
        } else if (2 == this.data._datasetId) {
            if (!e) return void wx.navigateBack({
                delta: 1
            });
            if ("" == this.data.CompanyName) return void wx.showToast({
                title: "请输入发票抬头",
                icon: "none",
                duration: 2e3
            });
            if ("" == this.data.CompanyContent) return void wx.showToast({
                title: "请输入发票内容",
                icon: "none",
                duration: 2e3
            });
            if ("" == this.data.CompanyNumber) return void wx.showToast({
                title: "请输入税号",
                icon: "none",
                duration: 2e3
            });
            wx.setStorageSync("billTitle", this.data.CompanyName), wx.setStorageSync("billContent", this.data.CompanyContent), 
            wx.setStorageSync("billContent3", this.data.CompanyNumber), wx.setStorageSync("billType", this.data.billType), 
            wx.navigateBack({
                delta: 1
            });
        }
    },
    switch1Change: function(t) {
        if (wx.setStorageSync("checked", t.detail.value), this.setData({
            checked: t.detail.value
        }), !t.detail.value) {
            try {
                wx.removeStorageSync("billTitle");
            } catch (t) {}
            try {
                wx.removeStorageSync("billContent");
            } catch (t) {}
            try {
                wx.removeStorageSync("billContent3");
            } catch (t) {}
            try {
                wx.removeStorageSync("billType");
            } catch (t) {}
        }
    }
});